	<?php require_once(dirname(__FILE__).'/inc/config.inc.php');IsModelPriv('userfield_list');
//模型标识
if(!empty($tbnames))
{
	$r = $dosql->GetOne("SELECT * FROM `#@__usermodel` WHERE `modeltbname`='$tbnames'");
	if(empty($r) && !is_array($r))
	{
		echo '<script>history.go(-1);</script>';
		exit();
	}
}
else
{
	echo '<script>history.go(-1);</script>';
	exit();
}
 ?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,initial-scale=1.0,user-scalable=no" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<title>添加扩展字段</title>
<link href="templates/css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" charset="utf-8" src="templates/js/jquery-1.11.2.min.js"></script>
<script type="text/javascript" charset="utf-8" src="templates/js/jquery.nicescroll.js"></script>
<script type="text/javascript" charset="utf-8" src="templates/js/Validform_v5.3.2_min.js"></script>
<script type="text/javascript" charset="utf-8" src="templates/js/laymain.js"></script>
<script type="text/javascript" charset="utf-8" src="templates/js/common.js"></script>
<script type="text/javascript">
   $(function () {
	  
	 $("#fieldtype").change(function(){
		var v = $(this).val();
		$.ajax({
			url : "ajax_do.php?action=fieldtype&type="+v,
			type:'get',
			dataType:'html',
			beforeSend:function(){},
			success:function(data, textStatus, xmlHttp){
				if(data != ''){
					$("#expand").html(data);
				}
			}
		});
	});
        //初始化表单验证
        $("#form").initValidform();
    });

</script>
</head>

<body class="mainbody">
<form name="form" id="form" method="post" action="userfield_save.php" >
<!--导航栏-->
<div class="location">
  <a href="javascript:history.back(-1);" class="back"><i></i><span>返回列表页</span></a>
  <a href="home.php" class="home"><i></i><span>首页</span></a>
  <i class="arrow"></i>
  <a href="usermodel.php"><span><?php echo $r['modeltitle'];?>模型</span> <i class="arrow"></i><span>添加扩展字段</span>
  <a href="javascript:location.reload();" class="reload">刷新</a> 
</div>
<div class="line10"></div>
<!--/导航栏-->

<!--内容-->
<div id="floatHead" class="content-tab-wrap">
  <div class="content-tab">
    <div class="content-tab-ul-wrap">
      <ul>
        <li><a class="selected" href="javascript:;">添加扩展字段</a></li>
      </ul>
    </div>
  </div>
</div>

<div class="tab-content" style="overflow: visible" >
	<dl>
	<dt>会员模型</dt>
	<dd><?php echo $r['modeltitle'];?></dd>
	</dl>
	
		<dl>
			<dt>字段类型</dt>
			<dd>
			<div class="rule-single-select"> 
			<select name="fieldtype" id="fieldtype" datatype="*" errormsg="请选择字段类型！" sucmsg=" ">
				<option selected="selected" value="">请选择字段类型...</option>
				<option value="varchar">单行文本</option>
				<option value="text">多行文本</option>
				<option value="mediumtext">编辑器</option>
				<option value="datetime">日期时间</option>
				<option value="number">数字</option>
				<option value="checkbox">多选菜单</option>
				<option value="radio">单选菜单</option>
				<option value="select">下拉菜单</option>
				<option value="file">单个附件[上传]</option>
				<option value="fileall">多个附件[上传]</option>
			</select>
			</div>

			</dd>
		</dl>		
		  <dl>
			<dt>字段标示</dt>
			<dd>
			<input type="text" name="fieldname" id="fieldname" class="input" datatype="/^[^_][a-zA-Z\-\_]{0,48}[^_]$/" sucmsg="" errormsg="仅能字母开头，不能以下划线结尾 2-50位" ajaxurl="ajax_do.php?action=public_checkfield&tbname=<?php echo $tbnames?>"  />
			  <span class="Validform_checktip">*字母、下划线，不可修改</span>
			</dd>
		  </dl> 
		  <dl>
			<dt>字段标题</dt>
			<dd>
				<input type="text" name="fieldtitle" id="fieldtitle" class="input"  datatype="*" />
			  <span class="Validform_checktip">*例如：文章标题</span>
			</dd>
		  </dl>	
			<dl>
			<dt>字段提示</dt>
			<dd>
				<input type="text" name="fielddesc" id="fielddesc" class="input normal" />
			</dd>
		  </dl>	
		  <div id="expand">

		  </div>   
		  <dl>
			<dt>校验正则</dt>
			<dd>
				<input type="text" name="fieldcheck" id="fieldcheck" class="input normal" />
				<div class="rule-single-select"> 
				<select name="fieldcheck_select" onchange="javascript:$('#fieldcheck').val(this.value)">
					<option value="">常用正则</option>
					<option value="/\S/">非空</option>
					<option value="/^[0-9-]+$/">整数</option>
					<option value="/^[a-z]+$/i">字母</option>
					<option value="/^[0-9a-z]+$/i">数字+字母</option>
					<option value="/^[\w\-\.]+@[\w\-\.]+(\.\w+)+$/">E-mail</option>
					<option value="/^[0-9]{5,20}$/">QQ</option>
					<option value="/^http:\/\//">超级链接</option>
					<option value="/^(1)[0-9]{10}$/">手机号码</option>
					<option value="/^[0-9-]{6,13}$/">电话号码</option>
					<option value="/^[0-9]{6}$/">邮政编码</option>
				</select></div>
			  <span class="Validform_checktip">*不需校验数据请留空</span>
			</dd>
		  </dl> 
		  <dl>
			<dt>未通过提示</dt>
			<dd>
			<textarea name="fieldcback" rows="2" cols="20" id="fieldcback" class="input"></textarea>

			  <span class="Validform_checktip">*字段的默认字符，可为空</span>
			</dd>
		  </dl> 
	<dl>
	
    <dt>是否为注册页字段</dt>
    <dd>
      <div class="rule-multi-radio">
        <span id="isreg"><input id="isreg_1" type="radio" name="isreg" value="true"  /><label for="isreg_1">是</label>
		<input id="isreg_2" type="radio" name="isreg" value="false" checked="checked" /><label for="isreg_2">否</label>
		</span>
      </div> <span class="Validform_checktip">*注册时填写项目</span>
    </dd>
  </dl>
   <dl>
    <dt>是否在前台显示</dt>
    <dd>
      <div class="rule-multi-radio">
        <span id="isadd"><input id="isadd_1" type="radio" name="isadd" value="true" checked="checked" /><label for="isadd_1">是</label>
		<input id="isadd_2" type="radio" name="isadd" value="false" /><label for="isadd_2">否</label>
		</span>
      </div>
    </dd>
  </dl>
   <dl>
    <dt>排列排序</dt>
    <dd>
     <input type="text" name="orderid" id="orderid" class="input small" value="<?php echo GetOrderID('#@__userfield'); ?>" />
    </dd>
  </dl>
     <dl>
    <dt>审　核</dt>
    <dd>
      <div class="rule-multi-radio">
        <span id="checkinfo"><input id="checkinfo_1" type="radio" name="checkinfo" value="true" checked="checked" /><label for="checkinfo_1">启用</label>
		<input id="checkinfo_2" type="radio" name="checkinfo" value="false" /><label for="checkinfo_2">禁用</label>
		</span>
      </div> <span class="Validform_checktip">*字段是否可用</span>
    </dd>
  </dl>
	
</div>
<!--/内容-->

<!--工具栏-->
<div class="page-footer">
  <div class="btn-wrap">
  <input type="submit" name="btnSubmit" value="提交保存" id="btnSubmit" class="btn" />
    <input name="btnReturn" type="button" value="返回上一页" class="btn yellow" onclick="javascript:history.back(-1);" />
	<input type="hidden" name="action" id="action" value="add" />
	<input type="hidden" name="tbnames" value="<?php echo $tbnames;?>" />
	<input type="hidden" name="infotype" value="<?php echo $r['id'];?>" />
  </div>
</div>
<!--/工具栏-->

</form>
</body>
</html>